import { reqBanner, reqFloor } from '@/api'

let actions = {
  // banner数据方法
  async getBanner({ commit }) {
    let result = await reqBanner() //发送请求
    commit('GETBANNER', result.data)
  },
  async getfloor({ commit }) {
    let reslut = await reqFloor()
    // console.log(reslut.data);
    commit('GETFLOOR', reslut.data)
  }

}

let mutations = {
  //首页列表数据
  GetMenuList(state, value) {
    state.meunArr = value
  },
  // banner轮播数据
  GETBANNER(state, value) {
    // console.log(state, value);
    state.bannerList = value
  },
  GETFLOOR(state, value) {
    state.floorList = value //请求的数据回来,将准备的空数据替换请求的数据
  }
}

let state = {

  meunArr: [],// 存放商品菜单数据
  bannerList: [], //存放banner轮播的空数组
  floorList: [],   //存放楼层数据的空数组
}

let getters = {}


export default {
  actions,
  mutations,
  state,
  getters
}